<template>
	<view class="shop-name">
		<view class="box">
			<view>
				<input type="text" maxlength="14" v-model="storeMsg.shname" placeholder="请填写名称(限制在14字哟)" />

			</view>
			<text>准确的店铺名称能让用户更好的牢记在心</text>
			<view class="btn">
				<button type="primary" size="mini" @click="onConfirm">确认</button>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from "vuex";
	export default {
		data() {
			return {
				shname1: '',
				storeMsg: {},
			}
		},
		onLoad() {
			// this.shname1 = this.storeInfo.shname;
		},
		
		onShow() {
			this.storeMsg = uni.getStorageSync('lph-storeInfo');
		},
		computed: {
			...mapState(['storeInfo']),
		},
		methods: {
			...mapMutations(['changeStoreInfo']),
			async onConfirm(){
				let a = await this.$http.setShName({shname: this.storeMsg.shname,shid: 1});
				if(a.code == 200) {
					uni.setStorageSync('lph-storeInfo',this.storeMsg);
					uni.showToast({
						title: '修改成功'
					})
					setTimeout(() => {
						uni.navigateBack()
					},500)
				}
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	@import 'static/css/myStore.scss';
</style>
